package org.oslo.sessioninfo.ejb;

import java.rmi.RemoteException;
import java.util.ArrayList;

import javax.ejb.EJBException;
import javax.ejb.SessionBean;
import javax.ejb.SessionContext;

import org.oslo.sessioninfo.domain.SessionInfo;
import org.oslo.sessioninfo.domain.SessionsTO;
import org.oslo.sessioninfo.util.XMLReader;

public class SessionInfoBean implements SessionBean {

	private static final long serialVersionUID = -6020382898983516910L;
	@SuppressWarnings("unused") private SessionContext sessionContext;
	
	public void setSessionContext(SessionContext sessionContext) throws EJBException, RemoteException {
		this.sessionContext = sessionContext;
	}
	
	public SessionsTO getSessionInfo(String conferenceName, String searchIdentifier) {
		System.out.println("called getSessionInfo with conference " + conferenceName);
		ArrayList<SessionInfo> sessionList = null;
		try {
			sessionList = XMLReader.getSessionInfo(conferenceName);
		} catch(Exception e) {
			e.printStackTrace();
		}
		SessionsTO sessionsTO = new SessionsTO();
		sessionsTO.setSessionList(sessionList);
		sessionsTO.setSearchIdentifier(searchIdentifier);
		return sessionsTO;
	}
	
	public void ejbCreate() {
	}
	
	public void ejbActivate() throws EJBException, RemoteException {
	}

	public void ejbPassivate() throws EJBException, RemoteException {
	}

	public void ejbRemove() throws EJBException, RemoteException {
	}

}
